package com.ssy.lingxi.logistics.entity;

import com.ssy.lingxi.logistics.convert.JpaJsonToStringListConverter;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 运费模板指定地区实体类
 *
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/14
 */
@Data
@Entity
@Table(schema = "public", name = "ls_logistics_freight_template_designate",
        indexes = {@Index(name = "ls_logistics_freight_template_designate_freight_template_id_idx", columnList = "freightTemplateId")})
public class FreightTemplateDesignate implements Serializable {

    private static final long serialVersionUID = 6634073211209131472L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "logistics_freight_template_designate_seq")
    @SequenceGenerator(sequenceName = "ls_logistics_freight_template_designate_seq", name = "logistics_freight_template_designate_seq", allocationSize = 1)
    private Long id;

    /**
     * 运费模板id
     */
    @Column
    private Long freightTemplateId;

    /**
     * 地区编号
     */
    @Convert(converter = JpaJsonToStringListConverter.class)
    @Column(columnDefinition = "jsonb")
    private List<String> areaIds;

    /**
     * 重量(KG)
     */
    @Column
    private Double weight;

    /**
     * 价格(元)
     */
    @Column
    private BigDecimal price;

    /**
     * 每增加重量(KG)
     */
    @Column
    private Double incrementWeight;

    /**
     * 每增加价格(元)
     */
    @Column
    private BigDecimal incrementPrice;

}
